package io.jee.runshan.handler;

import io.jee.runshan.domain.Information;
import io.jee.runshan.domain.remote.weixin.InputMessage;
import io.jee.runshan.domain.remote.weixin.OutputTextMessage;
import io.jee.runshan.service.IInformationService;
import io.jee.runshan.utils.SpringHolder;
import io.jee.runshan.utils.Utils;
import io.jee.runshan.utils.WeixinConstant;

/**
 * 公司简介处理
 * 
 * @author qinling.zhu
 *
 */
public class WeixinReceiverCompayHandler {

	private IInformationService informationService = SpringHolder.getBean(IInformationService.class);

	public String excute(InputMessage inputMsg) throws Exception {
		OutputTextMessage outputMsg = new OutputTextMessage();
		Information information = informationService.unique("type", Information.TYPE_COMPANY);
		if(information == null) {
			outputMsg.setContent("暂无公司简介");
		} else {
			if(Utils.isNullOrEmpty(information.getContent())){
				outputMsg.setContent("暂无公司简介");
			}else{
				outputMsg.setContent(information.getContent());
			}
		}
		return WeixinConstant.genMessage(outputMsg, inputMsg);
	}

}
